﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GroupThreeMESProject.Service.ProcurementPlanService
{
    public class Recevie
    {
        public static async Task ReceiveMessage()
        {
            string queueName = "simple_order";
            //    using (var connection = await RabbitMQHelper.GetConnection())
            //    {        
            //        var channel = await connection.CreateChannelAsync();

            //        // 创建队列
            //        await channel.QueueDeclareAsync(queueName, durable: false, exclusive: false, autoDelete: false, arguments: null);

            //        ////var consumer = new EventingBasicConsumer(channel);
            //        int i = 0;
            //        consumer.Received += (model, ea) =>
            //        {
            //            // 消费者业务处理
            //            var message = Encoding.UTF8.GetString(ea.Body.ToArray());
            //            Console.WriteLine($"{i}, 队列 {queueName} 消费消息: {message}");
            //            i++;
            //        };

            //        // 如果你使用的是非同步模式，则使用 BasicConsumeAsync
            //        await channel.BasicConsumeAsync(queueName, true, consumer);
            //    }
            //}
        }
    }
}
